import autoit


class ProcessControl(object):
    '''
    AutoIt进程相关操作

    :Attributes:
     - processName: 进程名称
    '''

    def __init__(self, processName):
        self.processName = processName

    def close(self):
        '''
        终止某个进程

        :Returns:
            1:成功; 0:失败.

        :Example:
         - 例: process.close()
        '''
        return autoit.process_close(self.processName)

    def exists(self):
        '''
        检查指定进程是否存在

        :Returns:
            PID:成功; 0:进程不存在.

        :Example:
         - 例: process.exists()
        '''
        return autoit.process_exists(self.processName)